using DynamicProxies;
using DynamicProxies.Tests.Types;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Reflection;

namespace DynamicProxies.Tests
{
	[TestClass]
	public sealed class StandardExceptionalTests : BaseTests
	{
		[TestMethod, ExpectedException(typeof(ArgumentNullException))]
		public void CreateProxyForNullTargetObject()
		{
			(null as SimpleClass).CreateProxy(this);
		}

		[TestMethod, ExpectedException(typeof(ArgumentException))]
		public void CreateProxyForSealedClass()
		{
			Proxy.Create<SealedClass>(this);
		}

		[TestMethod, ExpectedException(typeof(ArgumentException))]
		public void CreateProxyWithEmptyInvocationHandlerArray()
		{
			Proxy.Create<SimpleClass>(new IInvocationHandler[0]);
		}

		[TestMethod, ExpectedException(typeof(ArgumentNullException))]
		public void CreateProxyWithNullInvocationHandlerArray()
		{
			Proxy.Create<SimpleClass>((null as IInvocationHandler[]));
		}
	}
}
